package com.liangli.thread.taskasyn;

import com.liangli.thread.entity.Amazon;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: liangli
 * Date: 2021/10/9 18:07
 * Description:
 */
@Component
public class TestAsyncDemo1 {

    /**
     * 线程池异步调用
     *
     * @param i
     */
    @Async(value = "taskExecutor")
    public void testAsync(int i) {
        System.out.println("为"+i+"开始了一个线程"+Thread.currentThread().getName());
    }

    @Async(value = "taskExecutor")
    public void testAsync2(List<Amazon> amazonList) {
        System.out.println("开始了一个线程"+Thread.currentThread().getName()+"-----------"+amazonList.get(0).toString());
    }

}
